package com.whut.coc.application.impl.agent;

import com.whut.coc.api.agent.AgentApi;
import com.whut.coc.application.service.ConsultantService;
import dev.langchain4j.service.MemoryId;
import dev.langchain4j.service.UserMessage;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Flux;

/**
 * @author wangzonghe
 * @date 2025/6/20 15:27
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("/agent")
public class AgentApiImpl implements AgentApi {

    private final ConsultantService consultantService;
    /*@Override
    @GetMapping(("/chat"))
    public String chat(@RequestParam("question") String question) {
        String result = consultantService.chat(question);
        return result;
    }*/

    @Override
    @GetMapping(value = "/chat", produces = "text/html;charset=utf-8")
    public Flux<String>chat(@RequestParam("memoryId") String memoryId, @RequestParam("message") String question) {
        return consultantService.chat(memoryId, question);
    }

}
